const express = require('express');
const multer = require('multer');

const merchant = require('../../../app/controllers/o2o_merchant/merchant.controller.js');

let upload = multer();
module.exports = function (app) {
    const router = express.Router();
    // test router
    router.route('/test').get(function (req, resp) {
        resp.end('success');
    })

    //file upload
    let cpUpload = upload.fields([{ name: 'portrait', maxCount: 1 }, { name: 'idCard', maxCount: 1 }]);
    router.route('/register').post(cpUpload,merchant.register);
   
    router.route('/login').post(merchant.login);
    
    router.route('/reAudit').post(cpUpload,merchant.reAudit);

    router.route('/getLogin').get(merchant.getLogin);

    router.route('/exit').get(merchant.exit);

    app.use('/', router);


}